# @Time : 2020/12/17 15:16
# @Author : Fioman 
# @Phone : 13149920693
"""
神经网络训练工具
"""
import random
import time
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision.transforms as transforms

from torch.utils.data import DataLoader
from torch.autograd import Variable
import cv2 as cv
import numpy as np
import visdom
from PIL import Image,ImageDraw,ImageFont
from torchvision.models.resnet import resnet18,resnet34,resnet50,resnet101,resnet152


# 运行前需要在终端执行下面两行命令
# 监控显卡温度
# nvidia-smi.exe dmon
# 训练结果监视页面
# python -m visdom.server
# 在浏览器中输入: http://localhost:9097 即可启动

# 超参数设置
EPOCH = 50  # 所有图循环训练多少次
BATCH_SIZE = 2  # 每次训练几张
LR = 0.001 # 学习率
DROPOUT = 0.2  # 随机屏蔽多少神经元,用于缓解过拟合

# 用显卡填cuda,需要配置好cuda环境,不用显卡填cpu.
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# 当前网络采用加了dropout的resnet-101
net = resnet101().to(device)
